package com.group.sliding.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum DefaultFlag {
    DEFAULT(1, "默认地址"),
    NOT_DEFAULT(0, "非默认地址");

    @EnumValue
    @JsonValue
    private final int value;
    private final String desc;

    DefaultFlag(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static DefaultFlag of(boolean isDefault) {
        return isDefault ? DEFAULT : NOT_DEFAULT;
    }
}
